[PHP] Sorting data in an array
Posted
by kwokwai
on Stack Overflow
See other posts from Stack Overflow
or by kwokwai
Published on 2010-04-28T08:21:23Z
Indexed on
2010/04/28
8:23 UTC
Read the original article
Hit count: 351
php5
Hi all,
I got an array which has 7 types of fruit:
$fruits = array(
"lemon",
"orange",
"banana",
"apple",
"cherry",
"apricot",
"Blueberry"
);
I don't know how to print out the data in a way that the outcome will like this:
<A>
Apple, Apricot (Note that Apricot is followed by Apple in alphabetic order)
<B>
Banana
<C>
Cherry
<L>
Lemon
<O>
Orange
I am sorry that the question may be a bit difficult. But please kindly help if you could.
© Stack Overflow or respective owner